const fs = require('fs');
const path = require('path');
let local = process.cwd();

// 读取文件列表
let readFiles = function (pstr) {
    return new Promise((resolve, reject) => {
        fs.readFile(pstr, (err, data) => {
            if (err) throw err;
            resolve(data);
        });
    });
};

let asyncReadFile = async function (pstr) {
    // let realpth = path.resolve(local, "package.json");
    let f1 = await readFiles(pstr);
    return f1.toString();
};

 exports.robj =function(pth){
     return JSON.parse(fs.readFileSync(pth).toString());
 }


exports.readfile = asyncReadFile;